/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package com.latticeware.xtalk.app;

import java.awt.Component;
import java.awt.Image;
import java.awt.MediaTracker;
import java.awt.Toolkit;



/**
 *
 * @author sfisque
 */
public final class ImageFactory
{
    public Image POINTER_IMG;
    public Image BUTTON_IMG;
    public Image EQUIGON_IMG;
    public Image ERASER_IMG;
    public Image FIELD_IMG;
    public Image FREEHAND_IMG;
    public Image LASSO_IMG;
    public Image LINE_IMG;
    public Image MARQUEE_IMG;
    public Image OVAL_IMG;
    public Image PAINTBRUSH_IMG;
    public Image PAINTCAN_IMG;
    public Image PENCIL_IMG;
    public Image POLYGON_IMG;
    public Image RECTANGLE_IMG;
    public Image ROUNDRECT_IMG;
    public Image SPRAYCAN_IMG;
    public Image TEXT_IMG;
    
    private static ImageFactory instance;
    
    private MediaTracker tracker;

    
    private ImageFactory( Component c ) 
    throws InterruptedException
    {
        tracker = new MediaTracker( c );
        
        POINTER_IMG = Toolkit.getDefaultToolkit().getImage( "pointer_32.jpg" );
        tracker.addImage( POINTER_IMG, 0 );
        BUTTON_IMG = Toolkit.getDefaultToolkit().getImage( "button_32.jpg" );
        tracker.addImage( BUTTON_IMG, 1 );
        EQUIGON_IMG = Toolkit.getDefaultToolkit().getImage( "equigon_32.jpg" );
        tracker.addImage( EQUIGON_IMG, 2 );
        ERASER_IMG = Toolkit.getDefaultToolkit().getImage( "eraser_32.jpg" );
        tracker.addImage( ERASER_IMG, 3 );
        FIELD_IMG = Toolkit.getDefaultToolkit().getImage( "field_32.jpg" );
        tracker.addImage( FIELD_IMG, 4 );
        FREEHAND_IMG = Toolkit.getDefaultToolkit().getImage( "freehand_32.jpg" );
        tracker.addImage( FREEHAND_IMG, 5 );
        LASSO_IMG = Toolkit.getDefaultToolkit().getImage( "lasso_32.jpg" );
        tracker.addImage( LASSO_IMG, 6 );
        LINE_IMG = Toolkit.getDefaultToolkit().getImage( "line_32.jpg" );
        tracker.addImage( LINE_IMG, 7 );
        MARQUEE_IMG = Toolkit.getDefaultToolkit().getImage( "marquee_32.jpg" );
        tracker.addImage( MARQUEE_IMG, 8 );
        OVAL_IMG = Toolkit.getDefaultToolkit().getImage( "oval_32.jpg" );
        tracker.addImage( OVAL_IMG, 9 );
        PAINTBRUSH_IMG = Toolkit.getDefaultToolkit().getImage( "paintbrush_32.jpg" );
        tracker.addImage( PAINTBRUSH_IMG, 10 );
        PAINTCAN_IMG = Toolkit.getDefaultToolkit().getImage( "paintcan_32.jpg" );
        tracker.addImage( PAINTCAN_IMG, 11 );
        PENCIL_IMG = Toolkit.getDefaultToolkit().getImage( "pencil_32.jpg" );
        tracker.addImage( PENCIL_IMG, 12 );
        POLYGON_IMG = Toolkit.getDefaultToolkit().getImage( "polygon_32.jpg" );
        tracker.addImage( POLYGON_IMG, 13 );
        RECTANGLE_IMG = Toolkit.getDefaultToolkit().getImage( "rectangle_32.jpg" );
        tracker.addImage( RECTANGLE_IMG, 14 );
        ROUNDRECT_IMG = Toolkit.getDefaultToolkit().getImage( "roundrect_32.jpg" );
        tracker.addImage( ROUNDRECT_IMG, 15 );
        SPRAYCAN_IMG = Toolkit.getDefaultToolkit().getImage( "spraycan_32.jpg" );
        tracker.addImage( SPRAYCAN_IMG, 16 );
        TEXT_IMG = Toolkit.getDefaultToolkit().getImage( "text_32.jpg" );
        tracker.addImage( TEXT_IMG, 17 );
        
        tracker.waitForAll( 120 * 1000 );
    }
    
    
    public static ImageFactory
    getInstance( Component c ) 
    throws InterruptedException
    {
        if( instance == null )
        {
            instance = new ImageFactory( c );
        }
        
        return instance;
    }


    public Image getBUTTON_IMG()
    {
        return BUTTON_IMG;
    }


    public void setBUTTON_IMG(Image BUTTON_IMG)
    {
        this.BUTTON_IMG = BUTTON_IMG;
    }


    public Image getEQUIGON_IMG()
    {
        return EQUIGON_IMG;
    }


    public void setEQUIGON_IMG(Image EQUIGON_IMG)
    {
        this.EQUIGON_IMG = EQUIGON_IMG;
    }


    public Image getERASER_IMG()
    {
        return ERASER_IMG;
    }


    public void setERASER_IMG(Image ERASER_IMG)
    {
        this.ERASER_IMG = ERASER_IMG;
    }


    public Image getFIELD_IMG()
    {
        return FIELD_IMG;
    }


    public void setFIELD_IMG(Image FIELD_IMG)
    {
        this.FIELD_IMG = FIELD_IMG;
    }


    public Image getFREEHAND_IMG()
    {
        return FREEHAND_IMG;
    }


    public void setFREEHAND_IMG(Image FREEHAND_IMG)
    {
        this.FREEHAND_IMG = FREEHAND_IMG;
    }


    public Image getLASSO_IMG()
    {
        return LASSO_IMG;
    }


    public void setLASSO_IMG(Image LASSO_IMG)
    {
        this.LASSO_IMG = LASSO_IMG;
    }


    public Image getLINE_IMG()
    {
        return LINE_IMG;
    }


    public void setLINE_IMG(Image LINE_IMG)
    {
        this.LINE_IMG = LINE_IMG;
    }


    public Image getMARQUEE_IMG()
    {
        return MARQUEE_IMG;
    }


    public void setMARQUEE_IMG(Image MARQUEE_IMG)
    {
        this.MARQUEE_IMG = MARQUEE_IMG;
    }


    public Image getOVAL_IMG()
    {
        return OVAL_IMG;
    }


    public void setOVAL_IMG(Image OVAL_IMG)
    {
        this.OVAL_IMG = OVAL_IMG;
    }


    public Image getPAINTBRUSH_IMG()
    {
        return PAINTBRUSH_IMG;
    }


    public void setPAINTBRUSH_IMG(Image PAINTBRUSH_IMG)
    {
        this.PAINTBRUSH_IMG = PAINTBRUSH_IMG;
    }


    public Image getPAINTCAN_IMG()
    {
        return PAINTCAN_IMG;
    }


    public void setPAINTCAN_IMG(Image PAINTCAN_IMG)
    {
        this.PAINTCAN_IMG = PAINTCAN_IMG;
    }


    public Image getPENCIL_IMG()
    {
        return PENCIL_IMG;
    }


    public void setPENCIL_IMG(Image PENCIL_IMG)
    {
        this.PENCIL_IMG = PENCIL_IMG;
    }


    public Image getPOINTER_IMG()
    {
        return POINTER_IMG;
    }


    public void setPOINTER_IMG(Image POINTER_IMG)
    {
        this.POINTER_IMG = POINTER_IMG;
    }


    public Image getPOLYGON_IMG()
    {
        return POLYGON_IMG;
    }


    public void setPOLYGON_IMG(Image POLYGON_IMG)
    {
        this.POLYGON_IMG = POLYGON_IMG;
    }


    public Image getRECTANGLE_IMG()
    {
        return RECTANGLE_IMG;
    }


    public void setRECTANGLE_IMG(Image RECTANGLE_IMG)
    {
        this.RECTANGLE_IMG = RECTANGLE_IMG;
    }


    public Image getROUNDRECT_IMG()
    {
        return ROUNDRECT_IMG;
    }


    public void setROUNDRECT_IMG(Image ROUNDRECT_IMG)
    {
        this.ROUNDRECT_IMG = ROUNDRECT_IMG;
    }


    public Image getSPRAYCAN_IMG()
    {
        return SPRAYCAN_IMG;
    }


    public void setSPRAYCAN_IMG(Image SPRAYCAN_IMG)
    {
        this.SPRAYCAN_IMG = SPRAYCAN_IMG;
    }


    public Image getTEXT_IMG()
    {
        return TEXT_IMG;
    }


    public void setTEXT_IMG(Image TEXT_IMG)
    {
        this.TEXT_IMG = TEXT_IMG;
    }
    
}
